﻿using System;
using System.Collections.Generic;


namespace Jin.Core.Schema
{
    /// <summary>
    /// 表接口
    /// </summary>
   public interface ITable:IDBObject
    {
       /// <summary>
       /// 列集合
       /// </summary>
       IList<IColumn> Columns { get; set; }
       /// <summary>
       /// 关系条件
       /// </summary>
       IEnumerable<IRelation> Relations { get; }
       /// <summary>
       /// 是否有关系条件
       /// </summary>
       bool HasRelations { get; }
       /// <summary>
       /// 表名
       /// </summary>
       string ClassName { get; set; }
       /// <summary>
       /// 是否有主键
       /// </summary>
       bool HasPrimaryKey { get; }
       /// <summary>
       /// 主键列
       /// </summary>
       IColumn PrimaryKey { get; }
       /// <summary>
       /// 描述
       /// </summary>
       IColumn Descriptor { get; }
       /// <summary>
       /// 获取常见sql
       /// </summary>
       string CreateSql { get; }
       /// <summary>
       /// 获取删除sql、
       /// </summary>
       string DropSql { get; }
      /// <summary>
      /// 获取删除列sql
      /// </summary>
      /// <param name="columnName">列名</param>
      /// <returns></returns>
       string DropColumnSql(string columnName);
       /// <summary>
       /// 根据列名获取列字段类
       /// </summary>
       /// <param name="columnName"></param>
       /// <returns></returns>
       IColumn GetColumn(string columnName);
       /// <summary>
       /// 根据列名获取列的条件关系
       /// </summary>
       /// <param name="columnName"></param>
       /// <returns></returns>
       IRelation GetRelation(string columnName);
       /// <summary>
       /// 根据列名的获取的列的属性得到的列类
       /// </summary>
       /// <param name="columnName"></param>
       /// <returns></returns>
       IColumn GetColumnByPropertyName(string columnName);
    }
}
